package cn.hanyx.vlog.videoservice.controller;

import cn.hanyx.vlog.videoservice.dto.ResponseObject;
import cn.hanyx.vlog.videoservice.entity.Video;
import cn.hanyx.vlog.videoservice.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * VideoController
 *
 * @author hanyx
 * @date 2021/11/04
 */
@RestController
@RequestMapping("/video")
public class VideoController {

    @Autowired
    private VideoService videoService;

    @GetMapping("/{articleId}")
    public ResponseObject<Video> findByArticaleId(@PathVariable Long articleId) {
        ResponseObject<Video> responseObject = new ResponseObject<>(videoService.findByArticleId(articleId));
        return responseObject;
    }
}
